﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BloomFilter;
using System.Text.RegularExpressions;

namespace BloomFilterBuilder
{
    public class UrlFilterParam : IBloomFilterData<string>
    {
        public UrlFilterParam(string url)
        {
            KeyName = Regex.Match(url, @"(?<=://)[a-zA-Z\.0-9]+(?=\/)", RegexOptions.Singleline).Value;
            Value = BZ.Common.CommonUtility.GetMD5Str(url, false);
        }

        public string KeyName
        {
            get;
            set;
        }

        public string Value
        {
            get;
            set;
        }

        public bool IsValid()
        {
            return (!string.IsNullOrEmpty(KeyName)) & (!string.IsNullOrEmpty(Value));
        }
    }
}
